import java.io.*;

public class Demo2 {
    public static void main1(String[] args) {
        try(Reader reader = new FileReader("C:\\比特\\Java\\Gitee\\java\\文件操作\\src\\Demo.txt")) {
            while (true) {
                int n = reader.read();
                if(n == -1) break;
                char ch = (char)n;
                System.out.println(ch);
            }
        }catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        try(Writer writer = new FileWriter("C:\\比特\\Java\\Gitee\\java\\文件操作\\src\\Demo.txt")) {
            writer.write("你好 Java!");
        }catch (IOException e) {
            e.printStackTrace();
        }
    }
}
